home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / earcd / dev / mui / mui37_de.lha / Amiga-E / Examples / MUI-Demo.e < prev    next >
Text File  |  1996-08-25  |  30KB  |  940 lines

  1. /*
  2. **       E Source Code For The MUI Demo Program
  3. **       --------------------------------------
  4. **
  5. **    Original C Code written 1992-94 by Stefan Stuntz
  6. **
  7. **     Translation into E 1994 by Jan Hendrik Schulz
  8. **
  9. */
  10.  
  11. /*
  12. ** Tell AmigaE v3.1 that we use macros.
  13. */
  14.  
  15. OPT PREPROCESS   /* remove this for AmigaE v2.1b */
  16.  
  17. /*
  18. ** Loading the needed MODULEs
  19. */
  20.  
  21. MODULE 'muimaster', 'libraries/mui'
  22. MODULE 'utility/tagitem', 'utility/hooks'
  23. MODULE 'intuition/classes', 'intuition/classusr'
  24. MODULE 'libraries/gadtools'
  25.  
  26.  
  27. /*
  28. ** Defining CONSTs
  29. */
  30.  
  31. ENUM ID_ABOUT=1, ID_NEWVOL, ID_NEWBRI   /* for the menu definition */
  32. ENUM ER_NON, ER_MUILIB, ER_APP          /* for the exception handling */
  33.  
  34.  
  35. /*
  36. ** DEFining the var´s
  37. */
  38.  
  39. DEF lvt_Brian:PTR TO LONG
  40. DEF menu
  41. DEF in_Master, in_Notify, in_Frames, in_Images, in_Groups,
  42.     in_Backfill, in_Listviews, in_Cycle, in_String
  43. DEF cya_Computer, cya_Printer, cya_Display
  44. /*
  45. ** For every object we want to refer later (e.g. for notification purposes)
  46. ** we need a pointer.
  47. */
  48. DEF ap_Demo
  49. DEF wi_Master,wi_Frames,wi_Images,wi_Notify,wi_Listviews,wi_Groups,wi_Backfill,wi_Cycle,wi_String
  50. DEF bt_Notify,bt_Frames,bt_Images,bt_Groups,bt_Backfill,bt_Listviews,bt_Cycle,bt_String,bt_Quit
  51. DEF pr_PropA,pr_PropH,pr_PropV,pr_PropL,pr_PropR,pr_PropT,pr_PropB
  52. DEF lv_Volumes,lv_Directory,lv_Computer,lv_Brian
  53. DEF cy_Computer,cy_Printer,cy_Display
  54. DEF mt_Computer,mt_Printer,mt_Display
  55. DEF st_Brian
  56. DEF ga_Gauge1,ga_Gauge2,ga_Gauge3
  57.  
  58.  
  59. /*
  60. ** main()
  61. */
  62.  
  63. PROC main() HANDLE
  64.  
  65. DEF signal, running, buf, result
  66.  
  67. /*
  68. ** Open the muimaster.library
  69. */
  70.  
  71.    IF (muimasterbase := OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN))=NIL THEN Raise(ER_MUILIB)
  72.  
  73. /*
  74. ** A little array definition:
  75. */
  76.  
  77. lvt_Brian := [    'Cheer up, Brian. You know what they say.',
  78.         'Some things in life are bad,',
  79.         'They can really make you mad.',
  80.         'Other things just make you swear and curse.',
  81.         'When you\are chewing on life\as grissle,',
  82.         'Don\at grumble, give a whistle.',
  83.         'And this\all help things turn out for the best,',
  84.         'And...',
  85.         '',
  86.         'Always look on the bright side of life',
  87.         'Always look on the light side of life',
  88.         '',
  89.         'If life seems jolly rotten,',
  90.         'There\as something you\ave forgotten,',
  91.         'And that\as to laugh, and smile, and dance, and sing.',
  92.         'When you\are feeling in the dumps,',
  93.         'Don\at be silly chumps,',
  94.         'Just purse your lips and whistle, that\as the thing.',
  95.         'And...',
  96.         '',
  97.         'Always look on the bright side of life, come on!',
  98.         'Always look on the right side of life',
  99.         '',
  100.         'For life is quite absurd,',
  101.         'And death\as the final word.',
  102.         'You must always face the curtain with a bow.',
  103.         'Forget about your sin,',
  104.         'Give the audience a grin.',
  105.         'Enjoy it, it\as your last chance anyhow,',
  106.         'So...',
  107.         '',
  108.         'Always look on the bright side of death',
  109.         'Just before you draw your terminal breath.',
  110.         '',
  111.         'Life\as a piece of shit,',
  112.         'When you look at it.',
  113.         'Life\as a laugh, and death\as a joke, it\as true.',
  114.         'You\all see it\as all a show,',
  115.         'Keep \aem laughing as you go,',
  116.         'Just remember that the last laugh is on you.',
  117.         'And...',
  118.         '',
  119.         'Always look on the bright side of life !',
  120.         '',
  121.         '...',
  122.         '',
  123.         '[Thanx to sprooney@unix1.tcd.ie and to M. Python]',
  124.         NIL ]
  125.  
  126.  
  127. /*
  128. ** Convetional GadTools NewMenu structure, a memory
  129. ** saving way of definig menus.
  130. */
  131.  
  132. menu := [ NM_TITLE,0, 'Project'  , 0 ,0,0,0,
  133.       NM_ITEM ,0, 'About...' ,'?',0,0,ID_ABOUT,
  134.       NM_ITEM ,0, NM_BARLABEL, 0 ,0,0,0,
  135.       NM_ITEM ,0, 'Quit'     ,'Q',0,0,MUIV_Application_ReturnID_Quit,
  136.       NM_END  ,0, NIL     , 0 ,0,0,0]:newmenu
  137.  
  138.  
  139. /*
  140. ** Here are all the little info texts
  141. ** that appear at the top of each demo window.
  142. */
  143.  
  144. in_Master := '\tWelcome to the MUI demonstration program. ' +
  145.    'This little toy will show you how easy it is to create graphical user interfaces ' +
  146.    'with MUI and how powerful the results are.\n\tMUI is based on BOOPSI, Amiga\as ' +
  147.    'basic object oriented programming system. For details about programming, see the ' +
  148.    '\aReadMe\a file and the documented source code of this demo. Only one thing so far: ' +
  149.    'it\as really easy!\n\tNow go on, click around and watch this demo. Or use your ' +
  150.    'keyboard (TAB, Return, Cursor-Keys) if you like that better. Hint: play ' +
  151.    'around with the MUI preferences program and customize every pixel to fit ' +
  152.    'your personal taste.'
  153.  
  154. in_Notify := '\tMUI objects communicate with each other ' +
  155.    'with the aid of a notifcation system. This system is frequently used in every ' +
  156.    'MUI application. Binding an up and a down arrow to a prop gadget e.g. makes up ' +
  157.    'a scrollbar, binding a scrollbar to a list makes up a listview. You can also ' +
  158.    'bind windows to buttons, thus the window will be opened when the button is ' +
  159.    'pressed.\n\tRemember: The main loop of this demo program simply consists of ' +
  160.    'a Wait(). Once set up, MUI handles all user actions concerning the GUI ' +
  161.    'automatically.'
  162.  
  163. in_Frames := '\tEvery MUI object can have a surrounding frame. ' +
  164.    'Several types are available, all adjustable with the preferences program.'
  165.  
  166. in_Images := '\tMUI offers a vector image class, that allows ' +
  167.    'images to be zoomed to any dimension. Every MUI image is transformed to match the ' +
  168.    'current screens colors before displaying.\n\tThere are several standard images for ' +
  169.    'often used GUI components (e.g. Arrows). These standard images can be defined via ' +
  170.    'the preferences program.'
  171.  
  172. in_Groups := '\tGroups are very important for MUI. Their ' +
  173.    'combinations determine how the GUI will look. A group may contain any number of ' +
  174.    'child objects, which are positioned either horizontal or vertical.\n\tWhen a ' +
  175.    'group is layouted, the available space is distributed between all of its ' +
  176.    'children, depending on their minimum and maximum dimensions and on their ' +
  177.    'weight.\n\tOf course, the children of a group may be other groups. There ' +
  178.    'are no restrictions.'
  179.  
  180. in_Backfill := '\tEvery object can have its own background, ' +
  181.    'if it wants to. MUI offers several standard backgrounds (e.g. one of the DrawInfo ' +
  182.    'pens or one of the rasters below).\nThe prefs program allows defining a large number ' +
  183.    'of backgrounds... try it!'
  184.  
  185. in_Listviews := '\tMUI\as list class is very flexible. A list can ' +
  186.    'be made up of any number of columns containing formatted text or even images. Several ' +
  187.    'subclasses of list class (e.g. a directory class and a volume class) are available. ' +
  188.    'All MUI lists have the capability of multi selection, just by setting a single ' +
  189.    'flag.\n\tThe small info texts at the top of each demo window are made with floattext ' +
  190.    'class. This one just needs a character string as input and formats the text according ' +
  191.    'to its width.'
  192.  
  193. in_Cycle := '\tCycle gadgets, radios buttons and simple lists ' +
  194.    'can be used to let the user pick exactly one selection from a list of choices. In this ' +
  195.    'example, all three possibilities are shown. Of course they are connected via notification, ' +
  196.    'so every object will immediately be notified and updated when necessary.'
  197.  
  198. in_String := '\tOf course, MUI offers a standard string gadget class ' +
  199.    'for text input. The gadget in this example is attached to the list, you can control the ' +
  200.    'list cursor from within the gadget.'
  201.  
  202.  
  203. /*
  204. ** This are the entries for the cycle gadgets and radio buttons.
  205. */
  206.  
  207. cya_Computer := [ 'Amiga 500','Amiga 600','Amiga 1000 :)','Amiga 1200','Amiga 2000',
  208.           'Amiga 3000','Amiga 4000', 'Amiga 4000T', 'Atari ST :(', NIL ]
  209. cya_Printer :=  [ 'HP Deskjet','NEC P6','Okimate 20',NIL ]
  210. cya_Display :=  [ 'A1081','NEC 3D','A2024','Eizo T660i',NIL ]
  211.  
  212.  
  213. /*
  214. ** This is where it all begins...
  215. **
  216. ** Every MUI application needs an application object
  217. ** which will hold general information and serve as
  218. ** a kind of anchor for user input, ARexx functions,
  219. ** commodities interface, etc.
  220. **
  221. ** An application may have any number of SubWindows
  222. ** which can all be created in the same call or added
  223. ** later, according to your needs.
  224. **
  225. ** Note that creating a window does not mean to
  226. ** open it, this will be done later by setting
  227. ** the windows open attribute.
  228. */
  229.  
  230.     ap_Demo := ApplicationObject,
  231.         MUIA_Application_Title,      'MUI-Demo',
  232.         MUIA_Application_Version,      '$VER: MUI-Demo 8.54E (12.07.94)',
  233.         MUIA_Application_Copyright,      'Copyright ©1992-94, Stefan Stuntz',
  234.         MUIA_Application_Author,      'Stefan Stuntz',
  235.         MUIA_Application_Description, 'Demonstrate the features of MUI.',
  236.         MUIA_Application_Base,      'MUIDEMO',
  237.         MUIA_Application_Menustrip,      Mui_MakeObjectA(MUIO_MenustripNM,[menu,0]),
  238.  
  239.         SubWindow,
  240.         wi_String := WindowObject,
  241.             MUIA_Window_Title, 'String',
  242.             MUIA_Window_ID, "STRG",
  243.             WindowContents, VGroup,
  244.             Child, list(in_String),
  245.             Child, lv_Brian := ListviewObject,
  246.                 MUIA_Listview_Input, MUI_TRUE,
  247.                 MUIA_Listview_List, ListObject,
  248.                 InputListFrame,
  249.                 End,
  250.             End,
  251.             Child, st_Brian := StringObject,
  252.                StringFrame,
  253.             End,
  254.             End,
  255.         End,
  256.  
  257.         SubWindow,
  258.         wi_Cycle := WindowObject,
  259.             MUIA_Window_Title, 'Cycle Gadgets & RadioButtons',
  260.             MUIA_Window_ID, "CYCL",
  261.             WindowContents, VGroup,
  262.             Child, list(in_Cycle),
  263.             Child, HGroup,
  264.                 Child, mt_Computer := Radio('Computer:',cya_Computer),
  265.                 Child, VGroup,
  266.                 Child, mt_Printer := Radio('Printer:',cya_Printer),
  267.                 Child, VSpace(0),
  268.                 Child, mt_Display := Radio('Display:',cya_Display),
  269.                 End,
  270.                 Child, VGroup,
  271.                 Child, ColGroup(2),
  272.                     GroupFrameT('Cycle Gadgets'),
  273.                     Child, KeyLabel1('Computer:',"c"),
  274.                     Child, cy_Computer := KeyCycle(cya_Computer,"c"),
  275.                     Child, KeyLabel1('Printer:' ,"p"),
  276.                     Child, cy_Printer  := KeyCycle(cya_Printer ,"p"),
  277.                     Child, KeyLabel1('Display:' ,"d"),
  278.                     Child, cy_Display  := KeyCycle(cya_Display ,"d"),
  279.                 End,
  280.                 Child, lv_Computer := ListviewObject,
  281.                     MUIA_Listview_Input, MUI_TRUE,
  282.                     MUIA_Listview_List, ListObject,
  283.                     InputListFrame,
  284.                     End,
  285.                 End,
  286.                 End,
  287.             End,
  288.             End,
  289.         End,
  290.  
  291.         SubWindow,
  292.         wi_Listviews := WindowObject,
  293.             MUIA_Window_Title, 'Listviews',
  294.             MUIA_Window_ID, "LIST",
  295.             WindowContents, VGroup,
  296.             Child, list(in_Listviews),
  297.             Child, HGroup,
  298.                 GroupFrameT('Dir & Volume List'),
  299.                 Child, lv_Directory := ListviewObject,
  300.                 MUIA_Listview_Input, MUI_TRUE,
  301.                 MUIA_Listview_MultiSelect, MUI_TRUE,
  302.                 MUIA_Listview_List, DirlistObject,
  303.                     InputListFrame,
  304.                     MUIA_Dirlist_Directory, 'ram:',
  305.                     MUIA_List_Title, MUI_TRUE,
  306.                 End,
  307.                 End,
  308.                 Child, lv_Volumes := ListviewObject,
  309.                 MUIA_Weight, 20,
  310.                 MUIA_Listview_Input, MUI_TRUE,
  311.                 MUIA_Listview_List, VolumelistObject,
  312.                     InputListFrame,
  313.                     MUIA_Dirlist_Directory, "ram:",
  314.                 End,
  315.                 End,
  316.             End,
  317.             End,
  318.         End,
  319.  
  320.         SubWindow,
  321.         wi_Notify := WindowObject,
  322.             MUIA_Window_Title, 'Notifying',
  323.             MUIA_Window_ID, "BRCA",
  324.             WindowContents, VGroup,
  325.             Child, list(in_Notify),
  326.             Child, HGroup,
  327.                 GroupFrameT('Connections'),
  328.                 Child, ga_Gauge1 := GaugeObject,
  329.                 GaugeFrame,
  330.                 MUIA_Gauge_Horiz, FALSE,
  331.                 MUIA_FixWidth, 16,
  332.                 End,
  333.                 Child, pr_PropL := vprop(),
  334.                 Child, pr_PropR := vprop(),
  335.                 Child, VGroup,
  336.                 Child, VSpace(0),
  337.                 Child, pr_PropA := hprop(),
  338.                 Child, HGroup,
  339.                     Child, pr_PropH := hprop(),
  340.                     Child, pr_PropV := hprop(),
  341.                 End,
  342.                 Child, VSpace(0),
  343.                 Child, VGroup,
  344.                     GroupSpacing(1),
  345.                     Child, ga_Gauge2 := GaugeObject,
  346.                     GaugeFrame,
  347.                     MUIA_Gauge_Horiz, MUI_TRUE,
  348.                     End,
  349.                     Child, ScaleObject,
  350.                     MUIA_Scale_Horiz, MUI_TRUE,
  351.                     End,
  352.                 End,
  353.                 Child, VSpace(0),
  354.                 End,
  355.                 Child, pr_PropT := vprop(),
  356.                 Child, pr_PropB := vprop(),
  357.                 Child, ga_Gauge3 := GaugeObject,
  358.                 GaugeFrame,
  359.                 MUIA_Gauge_Horiz, FALSE,
  360.                 MUIA_FixWidth, 16,
  361.                 End,
  362.             End,
  363.             End,
  364.         End,
  365.  
  366.         SubWindow,
  367.         wi_Backfill := WindowObject,
  368.             MUIA_Window_Title, 'Backfill',
  369.             MUIA_Window_ID, "BACK",
  370.             WindowContents, VGroup,
  371.             Child, list(in_Backfill),
  372.             Child, VGroup,
  373.                 GroupFrameT('Standard Backgrounds'),
  374.                 Child, HGroup,
  375.                 Child, RectangleObject,
  376.                     TextFrame,
  377.                     MUIA_Background, MUII_BACKGROUND,
  378.                 End,
  379.                 Child, RectangleObject,
  380.                     TextFrame,
  381.                     MUIA_Background, MUII_FILL,
  382.                 End,
  383.                 Child, RectangleObject,
  384.                     TextFrame,
  385.                     MUIA_Background, MUII_SHADOW,
  386.                 End,
  387.                 End,
  388.                 Child, HGroup,
  389.                 Child, RectangleObject,
  390.                     TextFrame,
  391.                     MUIA_Background, MUII_SHADOWBACK,
  392.                 End,
  393.                 Child, RectangleObject,
  394.                     TextFrame,
  395.                     MUIA_Background, MUII_SHADOWFILL,
  396.                 End,
  397.                 Child, RectangleObject,
  398.                     TextFrame,
  399.                     MUIA_Background, MUII_SHADOWSHINE,
  400.                 End,
  401.                 End,
  402.                 Child, HGroup,
  403.                 Child, RectangleObject,
  404.                     TextFrame,
  405.                     MUIA_Background, MUII_FILLBACK,
  406.                 End,
  407.                 Child, RectangleObject,
  408.                     TextFrame,
  409.                     MUIA_Background, MUII_SHINEBACK,
  410.                 End,
  411.                 Child, RectangleObject,
  412.                     TextFrame,
  413.                     MUIA_Background, MUII_FILLSHINE,
  414.                 End,
  415.                 End,
  416.             End,
  417.             End,
  418.         End,
  419.  
  420.         SubWindow,
  421.         wi_Groups := WindowObject,
  422.             MUIA_Window_Title, 'Groups',
  423.             MUIA_Window_ID, "GRPS",
  424.             WindowContents, VGroup,
  425.             Child, list(in_Groups),
  426.             Child, HGroup,
  427.                 GroupFrameT('Group Types'),
  428.                 Child, HGroup,
  429.                 GroupFrameT('Horizontal'),
  430.                 Child, RectangleObject, TextFrame, End,
  431.                 Child, RectangleObject, TextFrame, End,
  432.                 Child, RectangleObject, TextFrame, End,
  433.                 End,
  434.                 Child, VGroup,
  435.                 GroupFrameT('Vertical'),
  436.                 Child, RectangleObject, TextFrame, End,
  437.                 Child, RectangleObject, TextFrame, End,
  438.                 Child, RectangleObject, TextFrame, End,
  439.                 End,
  440.                 Child, ColGroup(3),
  441.                 GroupFrameT('Array'),
  442.                 Child, RectangleObject, TextFrame, End,
  443.                 Child, RectangleObject, TextFrame, End,
  444.                 Child, RectangleObject, TextFrame, End,
  445.                 Child, RectangleObject, TextFrame, End,
  446.                 Child, RectangleObject, TextFrame, End,
  447.                 Child, RectangleObject, TextFrame, End,
  448.                 Child, RectangleObject, TextFrame, End,
  449.                 Child, RectangleObject, TextFrame, End,
  450.                 Child, RectangleObject, TextFrame, End,
  451.                 End,
  452.             End,
  453.             Child, HGroup,
  454.                 GroupFrameT('Different Weights'),
  455.                 Child, TextObject,
  456.                 TextFrame,
  457.                 MUIA_Background, MUII_TextBack,
  458.                 MUIA_Text_Contents, '\ec25 kg',
  459.                 MUIA_Weight, 25,
  460.                 End,
  461.                 Child, TextObject,
  462.                 TextFrame,
  463.                 MUIA_Background, MUII_TextBack,
  464.                 MUIA_Text_Contents, '\ec50 kg',
  465.                 MUIA_Weight, 50,
  466.                 End,
  467.                 Child, TextObject,
  468.                 TextFrame,
  469.                 MUIA_Background, MUII_TextBack,
  470.                 MUIA_Text_Contents, '\ec75 kg',
  471.                 MUIA_Weight, 75,
  472.                 End,
  473.                 Child, TextObject,
  474.                 TextFrame,
  475.                 MUIA_Background, MUII_TextBack,
  476.                 MUIA_Text_Contents, '\ec100 kg',
  477.                 MUIA_Weight, 100,
  478.                 End,
  479.             End,
  480.             Child, HGroup,
  481.                 GroupFrameT('Fixed & Variable Sizes'),
  482.                 Child, TextObject,
  483.                 TextFrame,
  484.                 MUIA_Background, MUII_TextBack,
  485.                 MUIA_Text_Contents, 'fixed',
  486.                 MUIA_Text_SetMax, MUI_TRUE,
  487.                 End,
  488.                 Child, TextObject,
  489.                 TextFrame,
  490.                 MUIA_Background, MUII_TextBack,
  491.                 MUIA_Text_Contents, '\ecfree',
  492.                 MUIA_Text_SetMax, FALSE,
  493.                 End,
  494.                 Child, TextObject,
  495.                 TextFrame,
  496.                 MUIA_Background, MUII_TextBack,
  497.                 MUIA_Text_Contents, 'fixed',
  498.                 MUIA_Text_SetMax, MUI_TRUE,
  499.                 End,
  500.                 Child, TextObject,
  501.                 TextFrame,
  502.                 MUIA_Background, MUII_TextBack,
  503.                 MUIA_Text_Contents, '\ecfree',
  504.                 MUIA_Text_SetMax, FALSE,
  505.                 End,
  506.                 Child, TextObject,
  507.                 TextFrame,
  508.                 MUIA_Background, MUII_TextBack,
  509.                 MUIA_Text_Contents, 'fixed',
  510.                 MUIA_Text_SetMax, MUI_TRUE,
  511.                 End,
  512.             End,
  513.             End,
  514.         End,
  515.  
  516.         SubWindow,
  517.         wi_Frames := WindowObject,
  518.             MUIA_Window_Title, 'Frames',
  519.             MUIA_Window_ID, "FRMS",
  520.             WindowContents, VGroup,
  521.             Child, list(in_Frames),
  522.             Child, ColGroup(2),
  523.                 Child, TextObject,
  524.                 ButtonFrame,
  525.                 InnerSpacing(2,1),
  526.                 MUIA_Background, MUII_TextBack,
  527.                 MUIA_Text_Contents, '\ecButton',
  528.                 End,
  529.                 Child, TextObject,
  530.                 ImageButtonFrame,
  531.                 InnerSpacing(2,1),
  532.                 MUIA_Background, MUII_TextBack,
  533.                 MUIA_Text_Contents, '\ecImageButton',
  534.                 End,
  535.                 Child, TextObject,
  536.                 TextFrame,
  537.                 InnerSpacing(2,1),
  538.                 MUIA_Background, MUII_TextBack,
  539.                 MUIA_Text_Contents, '\ecText',
  540.                 End,
  541.                 Child, TextObject,
  542.                 StringFrame,
  543.                 InnerSpacing(2,1),
  544.                 MUIA_Background, MUII_TextBack,
  545.                 MUIA_Text_Contents, '\ecString',
  546.                 End,
  547.                 Child, TextObject,
  548.                 ReadListFrame,
  549.                 InnerSpacing(2,1),
  550.                 MUIA_Background, MUII_TextBack,
  551.                 MUIA_Text_Contents, '\ecReadList',
  552.                 End,
  553.                 Child, TextObject,
  554.                 InputListFrame,
  555.                 InnerSpacing(2,1),
  556.                 MUIA_Background, MUII_TextBack,
  557.                 MUIA_Text_Contents, '\ecInputList',
  558.                 End,
  559.                 Child, TextObject,
  560.                 PropFrame,
  561.                 InnerSpacing(2,1),
  562.                 MUIA_Background, MUII_TextBack,
  563.                 MUIA_Text_Contents, '\ecProp Gadget',
  564.                 End,
  565.                 Child, TextObject,
  566.                 GroupFrame,
  567.                 InnerSpacing(2,1),
  568.                 MUIA_Background, MUII_TextBack,
  569.                 MUIA_Text_Contents, '\ecGroup',
  570.                 End,
  571.             End,
  572.             End,
  573.         End,
  574.  
  575.         SubWindow,
  576.         wi_Images := WindowObject,
  577.             MUIA_Window_Title, 'Images',
  578.             MUIA_Window_ID, "IMGS",
  579.             WindowContents, VGroup,
  580.             Child, list(in_Images),
  581.             Child, HGroup,
  582.                 Child, ColGroup(2),
  583.                 GroupFrameT('Some Images'),
  584.                 Child, Label('ArrowUp:'),    Child, image(MUII_ArrowUp),
  585.                 Child, Label('ArrowDown:'),  Child, image(MUII_ArrowDown),
  586.                 Child, Label('ArrowLeft:'),  Child, image(MUII_ArrowLeft),
  587.                 Child, Label('ArrowRight:'), Child, image(MUII_ArrowRight),
  588.                 Child, Label('RadioButton:'),Child, image(MUII_RadioButton),
  589.                 Child, Label('File:'),       Child, image(MUII_PopFile),
  590.                 Child, Label('HardDisk:'),   Child, image(MUII_HardDisk),
  591.                 Child, Label('Disk:'),       Child, image(MUII_Disk),
  592.                 Child, Label('Chip:'),       Child, image(MUII_Chip),
  593.                 Child, Label('Drawer:'),     Child, image(MUII_Drawer),
  594.                 End,
  595.                 Child, VGroup,
  596.                 GroupFrameT('Scale Engine'),
  597.                 Child, VSpace(0),
  598.                 Child, HGroup,
  599.                     Child, scaledImage(MUII_RadioButton,1,17, 9),
  600.                     Child, scaledImage(MUII_RadioButton,1,20,12),
  601.                     Child, scaledImage(MUII_RadioButton,1,23,15),
  602.                     Child, scaledImage(MUII_RadioButton,1,26,18),
  603.                     Child, scaledImage(MUII_RadioButton,1,29,21),
  604.                 End,
  605.                 Child, VSpace(0),
  606.                 Child, HGroup,
  607.                     Child, scaledImage(MUII_CheckMark,1,13, 7),
  608.                     Child, scaledImage(MUII_CheckMark,1,16,10),
  609.                     Child, scaledImage(MUII_CheckMark,1,19,13),
  610.                     Child, scaledImage(MUII_CheckMark,1,22,16),
  611.                     Child, scaledImage(MUII_CheckMark,1,25,19),
  612.                     Child, scaledImage(MUII_CheckMark,1,28,22),
  613.                 End,
  614.                 Child, VSpace(0),
  615.                 Child, HGroup,
  616.                     Child, scaledImage(MUII_PopFile,0,12,10),
  617.                     Child, scaledImage(MUII_PopFile,0,15,13),
  618.                     Child, scaledImage(MUII_PopFile,0,18,16),
  619.                     Child, scaledImage(MUII_PopFile,0,21,19),
  620.                     Child, scaledImage(MUII_PopFile,0,24,22),
  621.                     Child, scaledImage(MUII_PopFile,0,27,25),
  622.                 End,
  623.                 Child, VSpace(0),
  624.                 End,
  625.             End,
  626.             End,
  627.         End,
  628.  
  629.         SubWindow,
  630.         wi_Master := WindowObject,
  631.             MUIA_Window_Title, 'MUI-Demo',
  632.             MUIA_Window_ID,    "MAIN",
  633.             WindowContents, VGroup,
  634.             Child, TextObject,
  635.                 GroupFrame,
  636.                 MUIA_Background, MUII_SHADOWFILL,
  637.                 MUIA_Text_Contents, '\ec\e8MUI - \ebM\enagic\ebU\enser\ebI\ennterface\nwritten 1992-94 by Stefan Stuntz',
  638.             End,
  639.             Child, list(in_Master),
  640.             Child, VGroup,
  641.                 GroupFrameT('Available Demos'),
  642.                 Child, HGroup,
  643.                 MUIA_Group_SameWidth, MUI_TRUE,
  644.                 Child, bt_Groups    := SimpleButton('_Groups'),
  645.                 Child, bt_Frames    := SimpleButton('_Frames'),
  646.                 Child, bt_Backfill  := SimpleButton('_Backfill'),
  647.                 End,
  648.                 Child, HGroup,
  649.                 MUIA_Group_SameWidth, MUI_TRUE,
  650.                 Child, bt_Notify    := SimpleButton('_Notify'),
  651.                 Child, bt_Listviews := SimpleButton('_Listviews'),
  652.                 Child, bt_Cycle     := SimpleButton('_Cycle'),
  653.                 End,
  654.                 Child, HGroup,
  655.                 MUIA_Group_SameWidth, MUI_TRUE,
  656.                 Child, bt_Images    := SimpleButton('_Images'),
  657.                 Child, bt_String    := SimpleButton('_Strings'),
  658.                 Child, bt_Quit      := SimpleButton('_Quit'),
  659.                 End,
  660.             End,
  661.             End,
  662.         End,
  663.         End
  664.  
  665.  
  666. /*
  667. ** See if the application was created.
  668. **
  669. ** Note that we do not need any
  670. ** error control for the sub objects since every error
  671. ** will automatically be forwarded to the parent object
  672. ** and cause this one to fail too.
  673. */
  674.  
  675.    IF ap_Demo=NIL THEN Raise(ER_APP)
  676.  
  677.  
  678.  
  679. /*
  680. ** Here comes the notifcation magic. Notifying means:
  681. ** When an attribute of an object changes, then please change
  682. ** another attribute of another object (accordingly) or send
  683. ** a method to another object.
  684. */
  685.  
  686. /*
  687. ** Lets bind the sub windows to the corresponding button
  688. ** of the master window.
  689. */
  690.  
  691.    doMethod(bt_Frames   ,[MUIM_Notify,MUIA_Pressed,FALSE,wi_Frames   ,3,MUIM_Set,MUIA_Window_Open,MUI_TRUE])
  692.    doMethod(bt_Images   ,[MUIM_Notify,MUIA_Pressed,FALSE,wi_Images   ,3,MUIM_Set,MUIA_Window_Open,MUI_TRUE])
  693.    doMethod(bt_Notify   ,[MUIM_Notify,MUIA_Pressed,FALSE,wi_Notify   ,3,MUIM_Set,MUIA_Window_Open,MUI_TRUE])
  694.    doMethod(bt_Listviews,[MUIM_Notify,MUIA_Pressed,FALSE,wi_Listviews,3,MUIM_Set,MUIA_Window_Open,MUI_TRUE])
  695.    doMethod(bt_Groups   ,[MUIM_Notify,MUIA_Pressed,FALSE,wi_Groups   ,3,MUIM_Set,MUIA_Window_Open,MUI_TRUE])
  696.    doMethod(bt_Backfill ,[MUIM_Notify,MUIA_Pressed,FALSE,wi_Backfill ,3,MUIM_Set,MUIA_Window_Open,MUI_TRUE])
  697.    doMethod(bt_Cycle    ,[MUIM_Notify,MUIA_Pressed,FALSE,wi_Cycle    ,3,MUIM_Set,MUIA_Window_Open,MUI_TRUE])
  698.    doMethod(bt_String   ,[MUIM_Notify,MUIA_Pressed,FALSE,wi_String   ,3,MUIM_Set,MUIA_Window_Open,MUI_TRUE])
  699.    doMethod(bt_Quit     ,[MUIM_Notify,MUIA_Pressed,FALSE,ap_Demo,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit])
  700.  
  701.  
  702. /*
  703. ** Automagically remove a window when the user hits the close gadget.
  704. */
  705.  
  706.    doMethod(wi_Images   ,[MUIM_Notify,MUIA_Window_CloseRequest,MUI_TRUE,wi_Images   ,3,MUIM_Set,MUIA_Window_Open,FALSE])
  707.    doMethod(wi_Frames   ,[MUIM_Notify,MUIA_Window_CloseRequest,MUI_TRUE,wi_Frames   ,3,MUIM_Set,MUIA_Window_Open,FALSE])
  708.    doMethod(wi_Notify   ,[MUIM_Notify,MUIA_Window_CloseRequest,MUI_TRUE,wi_Notify   ,3,MUIM_Set,MUIA_Window_Open,FALSE])
  709.    doMethod(wi_Listviews,[MUIM_Notify,MUIA_Window_CloseRequest,MUI_TRUE,wi_Listviews,3,MUIM_Set,MUIA_Window_Open,FALSE])
  710.    doMethod(wi_Groups   ,[MUIM_Notify,MUIA_Window_CloseRequest,MUI_TRUE,wi_Groups   ,3,MUIM_Set,MUIA_Window_Open,FALSE])
  711.    doMethod(wi_Backfill ,[MUIM_Notify,MUIA_Window_CloseRequest,MUI_TRUE,wi_Backfill ,3,MUIM_Set,MUIA_Window_Open,FALSE])
  712.    doMethod(wi_Cycle    ,[MUIM_Notify,MUIA_Window_CloseRequest,MUI_TRUE,wi_Cycle    ,3,MUIM_Set,MUIA_Window_Open,FALSE])
  713.    doMethod(wi_String   ,[MUIM_Notify,MUIA_Window_CloseRequest,MUI_TRUE,wi_String   ,3,MUIM_Set,MUIA_Window_Open,FALSE])
  714.  
  715.  
  716. /*
  717. ** Closing the master window forces a complete shutdown of the application.
  718. */
  719.  
  720.    doMethod(wi_Master,[MUIM_Notify,MUIA_Window_CloseRequest,MUI_TRUE,ap_Demo,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit])
  721.  
  722.  
  723. /*
  724. ** This connects the prop gadgets in the notification demo window.
  725. */
  726.  
  727.    doMethod(pr_PropA,[MUIM_Notify,MUIA_Prop_First,MUIV_EveryTime,pr_PropH,3,MUIM_Set,MUIA_Prop_First,MUIV_TriggerValue])
  728.    doMethod(pr_PropA,[MUIM_Notify,MUIA_Prop_First,MUIV_EveryTime,pr_PropV,3,MUIM_Set,MUIA_Prop_First,MUIV_TriggerValue])
  729.    doMethod(pr_PropH,[MUIM_Notify,MUIA_Prop_First,MUIV_EveryTime,pr_PropL,3,MUIM_Set,MUIA_Prop_First,MUIV_TriggerValue])
  730.    doMethod(pr_PropH,[MUIM_Notify,MUIA_Prop_First,MUIV_EveryTime,pr_PropR,3,MUIM_Set,MUIA_Prop_First,MUIV_TriggerValue])
  731.    doMethod(pr_PropV,[MUIM_Notify,MUIA_Prop_First,MUIV_EveryTime,pr_PropT,3,MUIM_Set,MUIA_Prop_First,MUIV_TriggerValue])
  732.    doMethod(pr_PropV,[MUIM_Notify,MUIA_Prop_First,MUIV_EveryTime,pr_PropB,3,MUIM_Set,MUIA_Prop_First,MUIV_TriggerValue])
  733.  
  734.    doMethod(pr_PropA ,[MUIM_Notify,MUIA_Prop_First   ,MUIV_EveryTime,ga_Gauge2,3,MUIM_Set,MUIA_Gauge_Current,MUIV_TriggerValue])
  735.    doMethod(ga_Gauge2,[MUIM_Notify,MUIA_Gauge_Current,MUIV_EveryTime,ga_Gauge1,3,MUIM_Set,MUIA_Gauge_Current,MUIV_TriggerValue])
  736.    doMethod(ga_Gauge2,[MUIM_Notify,MUIA_Gauge_Current,MUIV_EveryTime,ga_Gauge3,3,MUIM_Set,MUIA_Gauge_Current,MUIV_TriggerValue])
  737.  
  738.  
  739. /*
  740. ** And here we connect cycle gadgets, radio buttons and the list in the
  741. ** cycle & radio window.
  742. */
  743.  
  744.    doMethod(cy_Computer,[MUIM_Notify,MUIA_Cycle_Active,MUIV_EveryTime,mt_Computer,3,MUIM_Set,MUIA_Radio_Active,MUIV_TriggerValue])
  745.    doMethod(cy_Printer ,[MUIM_Notify,MUIA_Cycle_Active,MUIV_EveryTime,mt_Printer ,3,MUIM_Set,MUIA_Radio_Active,MUIV_TriggerValue])
  746.    doMethod(cy_Display ,[MUIM_Notify,MUIA_Cycle_Active,MUIV_EveryTime,mt_Display ,3,MUIM_Set,MUIA_Radio_Active,MUIV_TriggerValue])
  747.    doMethod(mt_Computer,[MUIM_Notify,MUIA_Radio_Active,MUIV_EveryTime,cy_Computer,3,MUIM_Set,MUIA_Cycle_Active,MUIV_TriggerValue])
  748.    doMethod(mt_Printer ,[MUIM_Notify,MUIA_Radio_Active,MUIV_EveryTime,cy_Printer ,3,MUIM_Set,MUIA_Cycle_Active,MUIV_TriggerValue])
  749.    doMethod(mt_Display ,[MUIM_Notify,MUIA_Radio_Active,MUIV_EveryTime,cy_Display ,3,MUIM_Set,MUIA_Cycle_Active,MUIV_TriggerValue])
  750.    doMethod(mt_Computer,[MUIM_Notify,MUIA_Radio_Active,MUIV_EveryTime,lv_Computer,3,MUIM_Set,MUIA_List_Active ,MUIV_TriggerValue])
  751.    doMethod(lv_Computer,[MUIM_Notify,MUIA_List_Active ,MUIV_EveryTime,mt_Computer,3,MUIM_Set,MUIA_Radio_Active,MUIV_TriggerValue])
  752.  
  753.  
  754. /*
  755. ** This one makes us receive input ids from several list views.
  756. */
  757.  
  758.    doMethod(lv_Volumes ,[MUIM_Notify,MUIA_Listview_DoubleClick,MUI_TRUE,ap_Demo,2,MUIM_Application_ReturnID,ID_NEWVOL])
  759.    doMethod(lv_Brian   ,[MUIM_Notify,MUIA_List_Active,MUIV_EveryTime,ap_Demo,2,MUIM_Application_ReturnID,ID_NEWBRI])
  760.  
  761.  
  762. /*
  763. ** Now lets set the TAB cycle chain for some of our windows.
  764. */
  765.  
  766.    doMethod(wi_Master   ,[MUIM_Window_SetCycleChain,bt_Groups,bt_Frames,bt_Backfill,bt_Notify,bt_Listviews,bt_Cycle,bt_Images,bt_String,NIL])
  767.    doMethod(wi_Listviews,[MUIM_Window_SetCycleChain,lv_Directory,lv_Volumes,NIL])
  768.    doMethod(wi_Cycle    ,[MUIM_Window_SetCycleChain,mt_Computer,mt_Printer,mt_Display,cy_Computer,cy_Printer,cy_Display,lv_Computer,NIL])
  769.    doMethod(wi_String   ,[MUIM_Window_SetCycleChain,st_Brian,NIL])
  770.  
  771.  
  772. /*
  773. ** Set some start values for certain objects.
  774. */
  775.  
  776.    doMethod(lv_Computer,[MUIM_List_Insert,cya_Computer,-1,MUIV_List_Insert_Bottom])
  777.    doMethod(lv_Brian   ,[MUIM_List_Insert,lvt_Brian,-1,MUIV_List_Insert_Bottom])
  778.    set(lv_Computer,MUIA_List_Active,0)
  779.    set(lv_Brian   ,MUIA_List_Active,0)
  780.    set(st_Brian   ,MUIA_String_AttachedList,lv_Brian)
  781.  
  782.  
  783. /*
  784. ** Everything's ready, lets launch the application. We will
  785. ** open the master window now.
  786. */
  787.  
  788.    set(wi_Master,MUIA_Window_Open,MUI_TRUE);
  789.  
  790.  
  791. /*
  792. ** This is the main loop. As you can see, it does just nothing.
  793. ** Everything is handled by MUI, no work for the programmer.
  794. **
  795. ** The only thing we do here is to react on a double click
  796. ** in the volume list (which causes an ID_NEWVOL) by setting
  797. ** a new directory name for the directory list. If you want
  798. ** to see a real file requester with MUI, wait for the
  799. ** next release of MFR :-)
  800. */
  801.  
  802.  
  803.    running := TRUE  /* Not for MUI -> no need to use MUI_TRUE */
  804.  
  805.    WHILE running
  806.  
  807.       result := doMethod(ap_Demo, [MUIM_Application_Input, {signal} ])
  808.  
  809.       SELECT result
  810.  
  811.      CASE MUIV_Application_ReturnID_Quit
  812.         running := FALSE
  813.  
  814.      CASE ID_NEWVOL
  815.         doMethod(lv_Volumes, [MUIM_List_GetEntry, MUIV_List_GetEntry_Active, {buf} ])
  816.         set(lv_Directory, MUIA_Dirlist_Directory, buf)
  817.  
  818.      CASE ID_NEWBRI
  819.         get(lv_Brian, MUIA_List_Active, {buf} )
  820.         set(st_Brian, MUIA_String_Contents, lvt_Brian[buf] )
  821.  
  822.      CASE ID_ABOUT
  823.         Mui_RequestA(ap_Demo, wi_Master, 0, NIL, 'OK', 'MUI-Demo\n© 1992-94 by Stefan Stuntz',NIL)
  824.  
  825.       ENDSELECT
  826.  
  827.       IF signal THEN Wait(signal)
  828.  
  829.    ENDWHILE
  830.  
  831. /*
  832. ** Call the exception handling with ER_NON, this will dispose the
  833. ** application object, close "muimaster.library" and end the program.
  834. */
  835.  
  836.   Raise(ER_NON)
  837.  
  838. EXCEPT
  839.   IF ap_Demo THEN Mui_DisposeObject(ap_Demo)
  840.   IF muimasterbase THEN CloseLibrary(muimasterbase)
  841.   
  842.   SELECT exception
  843.     CASE ER_MUILIB
  844.       WriteF('Failed to open \s.\n',MUIMASTER_NAME)
  845.       CleanUp(20)
  846.  
  847.     CASE ER_APP
  848.       WriteF('Failed to create application.\n')
  849.       CleanUp(20)
  850.       
  851.   ENDSELECT
  852. ENDPROC 0
  853.  
  854.  
  855. /*
  856. ** Some PROCs as replacement for macros
  857. */
  858.  
  859. PROC list(ftxt)
  860.     DEF obj
  861.     obj :=  ListviewObject,
  862.     MUIA_Weight, 50,
  863.     MUIA_Listview_Input, FALSE,
  864.     MUIA_Listview_List,FloattextObject,
  865.         MUIA_Frame, MUIV_Frame_ReadList,
  866.         MUIA_Floattext_Text, ftxt,
  867.         MUIA_Floattext_TabSize, 4,
  868.         MUIA_Floattext_Justify, MUI_TRUE,
  869.     End,
  870.     End
  871. ENDPROC obj
  872.  
  873. PROC image(nr)
  874.     DEF obj
  875.     obj := ImageObject,
  876.     MUIA_Image_Spec, nr,
  877.     End
  878. ENDPROC obj
  879.  
  880. PROC scaledImage(nr,s,x,y)
  881.     DEF obj
  882.     obj := ImageObject,
  883.     MUIA_Image_Spec, nr,
  884.     MUIA_FixWidth, x,
  885.     MUIA_FixHeight,y,
  886.     MUIA_Image_FreeHoriz, MUI_TRUE,
  887.     MUIA_Image_FreeVert,  MUI_TRUE,
  888.     MUIA_Image_State, s,
  889.     End
  890. ENDPROC obj
  891.  
  892. PROC hprop()
  893.     DEF obj
  894.     obj := PropObject,
  895.     PropFrame,
  896.     MUIA_Prop_Horiz, MUI_TRUE,
  897.     MUIA_FixHeight, 8,
  898.     MUIA_Prop_Entries, 111,
  899.     MUIA_Prop_Visible, 10,
  900.     End
  901. ENDPROC obj
  902.  
  903. PROC vprop()
  904.     DEF obj
  905.     obj := PropObject,
  906.     PropFrame,
  907.     MUIA_Prop_Horiz, FALSE,
  908.     MUIA_FixWidth , 8,
  909.     MUIA_Prop_Entries, 111,
  910.     MUIA_Prop_Visible, 10,
  911.     End
  912. ENDPROC obj
  913.  
  914.  
  915. /*
  916. ** doMethod (written by Wouter van Oortmerssen)
  917. */
  918.  
  919. PROC doMethod( obj:PTR TO object, msg:PTR TO msg )
  920.  
  921.     DEF h:PTR TO hook, o:PTR TO object, dispatcher
  922.  
  923.     IF obj
  924.         o := obj-SIZEOF object    /* instance data is to negative offset */
  925.         h := o.class
  926.         dispatcher := h.entry    /* get dispatcher from hook in iclass */
  927.         MOVEA.L h,A0
  928.         MOVEA.L msg,A1
  929.         MOVEA.L obj,A2        /* probably should use CallHookPkt, but the */
  930.         MOVEA.L dispatcher,A3    /*   original code (DoMethodA()) doesn't. */
  931.         JSR (A3)        /* call classDispatcher() */
  932.         MOVE.L D0,o
  933.         RETURN o
  934.     ENDIF
  935. ENDPROC NIL
  936.  
  937. /*
  938. ** This is the end...
  939. */
  940.